#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    vector<string> sortPeople(vector<string>& names, vector<int>& heights)
    {
        int n = names.size();
        vector<int> index(n);
        for (int i = 0; i < n; i++) index[i] = i;
        sort(index.begin(), index.end(), [&](int p1, int p2) {return heights[p1] > heights[p2]; });
        vector<string> ret;
        for (auto& e : index) ret.push_back(names[e]);
        return ret;
    }
};

class Solution {
public:
    int wiggleMaxLength(vector<int>& nums)
    {
        int n = nums.size();
        int left = 0, right = 0;
        int ret = 0;
        for (int i = 0; i < n - 1; i++)
        {
            right = nums[i + 1] - nums[i];
            if (right == 0) continue;
            if (right * left <= 0) ret++;
            left = right;
        }
        return ret + 1;
    }
};